package cn.bistu.cs.music.util;

import com.google.gson.Gson;

import cn.bistu.cs.music.gson.MusicId2Url;
import cn.bistu.cs.music.gson.SelectMusicbyName;
import okhttp3.Response;

public class Utility {
    /**
     * 解析出下载歌曲的url
     */
    public static MusicId2Url handleMusicId2UrlResponse(Response response) {
        try {
            return new Gson().fromJson(response.body().string(), MusicId2Url.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return null;
    }
    public static SelectMusicbyName jsonTOSelectMusic(Response response){
        try{
            return new Gson().fromJson(response.body().string(),SelectMusicbyName.class);
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }

    }

}
